<?php
/**
 * Created by PhpStorm.
 * User: dongkai
 * Date: 2018/3/18
 * Time: 下午4:43
 */
namespace App\Model\Protobuf;

use App\Model\Model;
use AutoMsg\LoadRecordType;
use AutoMsg\LoadRoleInfo;

class LoadRole extends ProtoCommon
{
    function index($obj){
        $pt = new LoadRoleInfo();
        foreach ($obj as $item) {
            echo $item->getRoleId();
            $pt->mergeFrom($item);
            $Gold = $pt->getGold();
            $RoleId = $pt->getRoleId();
            $Level = $pt->getLevel();
            $Name = $pt->getName();
            $ActivedAchievement = $pt->getActivedAchievement();
            $Affinity = $pt->getAffinity();
            $AuctionShopId = $pt->getAuctionShopId();
            $Avatar = $pt->getAvatar()->getIterator();//rep
            $Avatar = $this->repeated($Avatar);
            $Certificates = $pt->getCertificates()->getIterator();
            $Certificates = $this->repeated($Certificates);

            $CertificatesExp = $pt->getCertificatesExp();
            $CertificatesExp = $this->repeated($CertificatesExp);
            $Charm = $pt->getCharm();
            $Concentration = $pt->getConcentration();
            $Constitution =  $pt->getConstitution();
            $Desc = $pt->getDesc();
            $Exp = $pt->getExp();
            $Icon = $pt->getIcon();
            $Intelligence = $pt->getIntelligence();
            $LastLoginTime = $pt->getLastLoginTime();
            $LoadRecordType = $pt->getLoadRecordType()->getIterator();

            $LoadRecordType = $this->LoadRecordType($LoadRecordType);

            $PkLostCount = $pt->getPkLostCount();
            $PkPingCount = $pt->getPkPingCount();
            $Power = $pt->getPower();
            $PraiseTime = $pt->getPraiseTime();
            $RecordPraiseRole = $pt->getRecordPraiseRole();
            $RecordPraiseRole = $this->repeated($RecordPraiseRole);
            $RedPacketMaxMoney = $pt->getRedPacketMaxMoney();
            $RoomPraiseTime = $pt->getRoomPraiseTime();
            $Sex = $pt->getSex();
            $SocialStatus = $pt->getSocialStatus();
            $Type = $pt->getType();
            $VipLevel = $pt->getVipLevel();
            $WhetherTheLoan = $pt->getWhetherTheLoan();
            $arr['Gold'] = $Gold;
            $arr['RoleId'] = $RoleId;
            $arr['Level'] = $Level;
            $arr['Name'] = $Name;
            $arr['ActivedAchievement'] = $ActivedAchievement;
            $arr['Affinity'] = $Affinity;
            $arr['AuctionShopId'] = $AuctionShopId;
            $arr['Avatar'] = $Avatar;
            $arr['Certificates'] = $Certificates;
            $arr['CertificatesExp'] = $CertificatesExp;
            $arr['Charm'] = $Charm;
            $arr['Concentration'] = $Concentration;
            $arr['Constitution'] = $Constitution;
            $arr['Desc'] = $Desc;
            $arr['Exp'] = $Exp;
            $arr['Icon'] = $Icon;
            $arr['Intelligence'] = $Intelligence;
            $arr['LastLoginTime'] = $LastLoginTime;
            $arr['LoadRecordType'] = $LoadRecordType;
            $arr['PkLostCount'] = $PkLostCount;
            $arr['PkPingCount'] = $PkPingCount;
            $arr['Power'] = $Power;
            $arr['PraiseTime'] = $PraiseTime;
            $arr['RecordPraiseRole'] = $RecordPraiseRole;
            $arr['RedPacketMaxMoney'] = $RedPacketMaxMoney;
            $arr['RoomPraiseTime'] = $RoomPraiseTime;
            $arr['Sex'] = $Sex;
            $arr['SocialStatus'] = $SocialStatus;
            $arr['Type'] = $Type;
            $arr['VipLevel'] = $VipLevel;
            $arr['WhetherTheLoan'] = $WhetherTheLoan;
        }
        return $arr;
    }


    function LoadRecordType($obj){
        $LoadRecordType = new LoadRecordType();
        $LoadRecordType->getPraiseTime();
        foreach ($obj as $k => $item) {
            $PraiseTime = $item->getPraiseTime();
            $RecordPraiseRole = $item->getRecordPraiseRole();
            $RecordPraiseRole = $this->repeated($RecordPraiseRole);
            var_dump($PraiseTime);
            var_dump($RecordPraiseRole);
        }
    }

}